package com.ltedu.auth.domain;

public class Oauth2Token {

    /**
     * 访问令牌
     */
    private String token;

    /**
     * 刷新令牌
     */
    private String refreshToken;

    /**
     * 访问令牌头前缀
     */
    private String tokenHead;

    /**
     * 有效时间(秒)
     */
    private int expiresIn;

    public static Builder builder() {
        return new Builder();
    }

    public Oauth2Token(Builder builder){
        this.token = builder.token;
        this.refreshToken = builder.refreshToken;
        this.tokenHead = builder.tokenHead;
        this.expiresIn = builder.expiresIn;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getRefreshToken() {
        return refreshToken;
    }

    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }

    public String getTokenHead() {
        return tokenHead;
    }

    public void setTokenHead(String tokenHead) {
        this.tokenHead = tokenHead;
    }

    public int getExpiresIn() {
        return expiresIn;
    }

    public void setExpiresIn(int expiresIn) {
        this.expiresIn = expiresIn;
    }

    public static class Builder {
        /**
         * 访问令牌
         */
        private String token;

        /**
         * 刷新令牌
         */
        private String refreshToken;

        /**
         * 访问令牌头前缀
         */
        private String tokenHead;

        /**
         * 有效时间(秒)
         */
        private int expiresIn;

        public Builder token(String token) {
            this.token = token;
            return this;
        }

        public Builder refreshToken(String refreshToken) {
            this.refreshToken = refreshToken;
            return this;
        }

        public Builder tokenHead(String tokenHead) {
            this.tokenHead = tokenHead;
            return this;
        }

        public Builder expiresIn(int expiresIn) {
            this.expiresIn = expiresIn;
            return this;
        }

        public Oauth2Token build() {
            return new Oauth2Token(this);
        }
    }
}